\defmodule {ParetoGen}

This class implements random variate generators for one of the {\em Pareto\/}
distributions, with parameters $\alpha>0$ and $\beta>0$.
Its density function is
\begin{htmlonly}
\eq
f(x) = \alpha\beta^{\alpha}\,/\, x^{\alpha+1}\mbox{ for }x>\beta, 0 \mbox{ otherwise.}
\endeq
\end{htmlonly}
\begin{latexonly}
\eq 
    f (x) = \left\{\begin{array}{ll}
          {\displaystyle\frac{\alpha\beta^\alpha}{x^{\alpha+1}}}
                  &\mbox{ for }x>\beta\\[12pt]
          0 & \mbox{ for }x\le\beta
          \end{array}\right.                        \eqlabel{eq:fpareto}
\endeq
\end{latexonly}
%
The (non-static) \texttt{nextDouble} method simply calls \texttt{inverseF} on the
distribution.

\bigskip\hrule

\begin{code}
\begin{hide}
/*
 * Class:        ParetoGen
 * Description:  random variate generators for the Pareto distribution
 * Environment:  Java
 * Software:     SSJ 
 * Copyright (C) 2001  Pierre L'Ecuyer and Universite de Montreal
 * Organization: DIRO, Universite de Montreal
 * @author       
 * @since

 * SSJ is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License (GPL) as published by the
 * Free Software Foundation, either version 3 of the License, or
 * any later version.

 * SSJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * A copy of the GNU General Public License is available at
   <a href="http://www.gnu.org/licenses">GPL licence site</a>.
 */
\end{hide}
package umontreal.iro.lecuyer.randvar;\begin{hide}
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;
\end{hide}

public class ParetoGen extends RandomVariateGen \begin{hide} {
   protected double alpha;
   protected double beta;
\end{hide}\end{code}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection* {Constructors}
\begin{code}

   public ParetoGen (RandomStream s, double alpha, double beta) \begin{hide} {
      super (s, new ParetoDist(alpha, beta));
      setParams(alpha, beta);
   }\end{hide}
\end{code} 
\begin{tabb} Creates a Pareto random variate generator with parameters $\alpha =$ 
   \texttt{alpha} and $\beta = $ \texttt{beta}, using stream \texttt{s}. 
\end{tabb}
\begin{code}

   public ParetoGen (RandomStream s, double alpha) \begin{hide} {
      this (s, alpha, 1.0);
   }\end{hide}
\end{code} 
\begin{tabb}  Creates a Pareto random variate generator with parameters $\alpha =$ 
   \texttt{alpha} and $\beta = 1$, using stream \texttt{s}. 
\end{tabb}
\begin{code}

   public ParetoGen (RandomStream s, ParetoDist dist) \begin{hide} {
      super (s, dist);
      if (dist != null)
         setParams(dist.getAlpha(), dist.getBeta());
   }\end{hide}
\end{code}
\begin{tabb} Creates a new generator for the Pareto distribution
   \texttt{dist} and stream \texttt{s}.
\end{tabb}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\subsubsection* {Methods}
\begin{code}

   public static double nextDouble (RandomStream s,
                                    double alpha, double beta)\begin{hide} {
      return ParetoDist.inverseF (alpha, beta, s.nextDouble());
   }\end{hide}
\end{code}
\begin{tabb}  Generates a new variate from the Pareto distribution
   with parameters $\alpha = $~\texttt{alpha} and $\beta = $~\texttt{beta}, 
   using stream \texttt{s}.
\end{tabb}
\begin{code}

   public double getAlpha()\begin{hide} {
      return alpha;
   }\end{hide}
\end{code}
\begin{tabb} Returns the parameter $\alpha$ of this object.
\end{tabb}
\begin{code}

   public double getBeta()\begin{hide} {
      return beta;
   }\end{hide}
\end{code}
\begin{tabb} Returns the parameter $\beta$ of this object.
\end{tabb}
\begin{code}\begin{hide}

   protected void setParams (double alpha, double beta) {
      if (alpha <= 0.0)
         throw new IllegalArgumentException ("alpha <= 0");
      if (beta <= 0.0)
         throw new IllegalArgumentException ("beta <= 0");
      this.alpha = alpha;
      this.beta = beta;
   }
}\end{hide}
\end{code}
